<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <META HTTP-EQUIV="pragma" CONTENT="no-cache">
    <META HTTP-EQUIV="Cache-Control" CONTENT="no-store, must-revalidate">
    <META HTTP-EQUIV="expires" CONTENT="Wed, 26 Feb 1997 08:21:57 GMT">
    <META HTTP-EQUIV="expires" CONTENT="0">
    <title>CPK查询</title>
    <link rel="stylesheet" type="text/css" href="./css/main.css" />
    <link rel="stylesheet" type="text/css" href="./layui/css/layui.css" />
    <link rel="stylesheet" type="text/css" href="./css/layuiAdminTheme.css" />
</head>
<style>
    .organizeName,
    .operation span:first-of-type {
        color: #1990FF;
    }
    td
    {
        white-space: nowrap;
        text-align: center;
    }
    .group{
        margin: 0 auto;
        width: 450px;
        height: auto;
    }
    .group div{
        width: 16%;
        height: 100%;
        float: left;
    }
</style>
<body>
<form class="layui-form" action="" lay-filter="data">
    <div class="layui-form-item">
        <div class="layui-inline">
            <label class="layui-form-label">搜索：</label>
            <input type="text" name="orderNum" id="orderNum" autocomplete="off" class="layui-input" style="width: 14em;" placeholder="LOT号">
        </div>
        <div class="layui-inline">
            <select id="deptName" type="text" name="cpkDept" class="layui-input" style="width: 8em;" lay-filter="cpkDept" onclick="isAdminOfOrder()">
                <option value="">请选择部门...</option>
            </select>
        </div>
        <div class="layui-inline">
            <button type="button" class="layui-btn" lay-submit="" lay-filter="searchBtn">查询CPK</button>
        </div>
    </div>
</form>
<div align="center" id="cpkTable" style="display: none">
    <table class="layui-table" >
        <thead>
        <tr>
            <!--          <th><input type="checkbox" id="select" onclick="selectAll()" /></th>-->
            <th style="text-align: center">工单号</th>
            <th style="text-align: center">产品名</th>
            <th style="text-align: center">CA</th>
            <th style="text-align: center">CP</th>
            <th style="text-align: center">CPK</th>
            <th style="text-align: center">作业机台</th>
            <th style="text-align: center">操作</th>
        </tr>
        </thead>
        <tbody id="allTBody"></tbody>
    </table>
    <div style="display: flex;">
        <!--      <button type="button" class="layui-btn layui-btn-xs" style="background: #F5222D;" onclick="deleteProject()">批量删除</button>-->
        <div style="flex: 1">
            <div class="pageNav">
          <span class="layui-breadcrumb" lay-separator="-">
            <a class="fristPage">首页</a>
            <a class="lastPage">上一页</a>
            <a><cite>第<span id="page"></span>页</cite></a>
            <a class="nextPage">下一页</a>
            <a class="endPage">尾页</a>
          </span>
            </div>
        </div>
    </div>
</div>

<div id="countResult" class="layui-card" style="display: none">
    <input type="text" name="numOfSearch" id="numOfSearch" autocomplete="off" class="layui-input" style="width: 14em;display: none">
    <div class="layui-card-header" style="background-color: #393D49;color: white">查询结果</div>
    <div class="layui-card-body">
        <div class="layui-row layui-col-space10">
            <div class="layui-col-md4">
                <table class="layui-table" style="width: auto;">
                    <colgroup>
                        <col width="150">
                        <col width="200">
                        <col>
                    </colgroup>
                    <thead>
                    <tr>
                        <th>计算项</th>
                        <th>数值(保留3位小数)</th>
                        <th>等级评定</th>
                    </tr>
                    </thead>
                    <tbody>
                    <tr>
                        <td style="color:#FF5722;font-weight: bold">CA(制程准确度)</td>
                        <td ID="CA_VALUE" style="color:#1E9FFF;"></td>
                        <td ID="CA_LEVEL"></td>
                    </tr>
                    <tr>
                        <td style="color:#FF5722;font-weight: bold">CP(制程精密度)</td>
                        <td id="CP_VALUE" style="color:#1E9FFF;"></td>
                        <td id="CP_LEVEL"></td>
                    </tr>
                    <tr>
                        <td style="color:#FF5722;font-weight: bold">CPK(制程能力指数)</td>
                        <td id="CPK_VALUE" style="color:#1E9FFF;"></td>
                        <td id="CPK_LEVEL"></td>
                    </tr>
                    </tbody>
                </table>
<!--                <button type="button" id="changeBtn" class="layui-btn layui-bg-green"> 修 改 结 果 </button>-->
                <button type="button" id="infoBtn" class="layui-btn layui-bg-green"> 详 情 </button>
            </div>
            <div class="layui-col-md8">
                <table class="layui-table" style="width: auto;">
                    <colgroup>
                        <col width="150">
                        <col width="200">
                        <col>
                    </colgroup>
                    <thead>
                    <tr>
                        <th>项名</th>
                        <th>等级划分</th>
                    </tr>
                    </thead>
                    <tbody>
                    <tr>
                        <td style="color:#FF5722;font-weight: bold">CA(制程准确度)</td>
                        <td>
                            <div class="group">
                                <div title="CA<12.5%" style="border-radius: 15px;background-color: #0df600"><b style="color:white;">A</b></div>
                                <div title="12.5<CA<25%" style="border-radius: 15px;background-color: greenyellow"><b style="color:white;">B</b></div>
                                <div title="25%<CA<50%" style="border-radius: 15px;background-color: #FFB800"><b style="color:white;">C</b></div>
                                <div title="CA>50%" style="border-radius: 15px;background-color: #FF5722"><b style="color:white;">D</b></div>
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <td style="color:#FF5722;font-weight: bold">CP(制程精密度)</td>
                        <td>
                            <div class="group">
                                <div title="1.67<=CP" style="border-radius: 15px;background-color: #0df600"><b style="color:white;">A+</b></div>
                                <div title="1.33<=CP<1.67" style="border-radius: 15px;background-color: greenyellow"><b style="color:white;">A</b></div>
                                <div title="1.0<=CP<1.33" style="border-radius: 15px;background-color: #FFB800"><b style="color:white;">B</b></div>
                                <div title="0.67<=CP<1.0" style="border-radius: 15px;background-color: #FF5722"><b style="color:white;">C</b></div>
                                <div title="CP<0.67" style="border-radius: 15px;background-color: #ff0000"><b style="color:white;">D</b></div>
                                <div title="∞" style="border-radius: 15px;background-color: #000000"><b style="color:white;">?</b></div>
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <td style="color:#FF5722;font-weight: bold">CPK(制程能力指数)</td>
                        <td>
                            <div class="group">
                                <div title="1.67<=CPK" style="border-radius: 15px;background-color: #0df600"><b style="color:white;">A+</b></div>
                                <div title="1.33<=CPK<1.67" style="border-radius: 15px;background-color: greenyellow"><b style="color:white;">A</b></div>
                                <div title="1.0<=CPK<1.33" style="border-radius: 15px;background-color: #FFB800"><b style="color:white;">B</b></div>
                                <div title="0.67<=CPK<1.0" style="border-radius: 15px;background-color: #FF5722"><b style="color:white;">C</b></div>
                                <div title="CPK<0.67" style="border-radius: 15px;background-color: #ff0000"><b style="color:white;">D</b></div>
                                <div title="∞" style="border-radius: 15px;background-color: #000000"><b style="color:white;">?</b></div>
                            </div>
                        </td>
                    </tr>
                    </tbody>
                </table>
            </div>
        </div>

    </div>
</div>

<script src="./js/main.js" charset="utf-8"></script>
<!--    <script src="https://cdn.jsdelivr.net/npm/jquery" charset="utf-8"></script>-->
<script src="./layui/layui.js" charset="utf-8"></script>
<script src="./js/jQuery.main.js"></script>
<script src="./js/xm-select.js"></script>
<script src="./js/echarts.js" charset="utf-8"></script>
<script>
    var displayStart = 1;
    //选项卡 依赖 element 模块，否则无法进行功能性操作
    layui.use('element', function(){
        var element = layui.element;

        //…
    });
    layui.use('form', function(){
        var form=layui.form;
        laydate = layui.laydate;

        form.on('submit(searchBtn)', function() {
            search(1);
            return false;
        });
        $('.fristPage').click(function() {
            search(1);
            return false;
        });
        $('.lastPage').click(function() {
            search((displayStart > 1 ? displayStart - 1 : 1));
            return false;
        });
        $('.nextPage').click(function() {
            search((displayStart < endPage ? displayStart + 1 : endPage));
            return false;
        });
        $('.endPage').click(function() {
            search(endPage);
            return false;
        })

        //部门下拉框
        $.ajax({
            url: url + '/sys-dept/listDept',
            method: 'POST',
            async : false,
            contentType: 'application/json',
            success: function(res) {
                //显示前先判断是否为管理员
                $.ajax({
                    url: '/sys-user/getAdmin/'+sessionStorage.getItem('userId'),
                    method: 'GET',
                    async : false,
                    contentType: 'application/json',
                    success: function (res) {
                        if (res.code===200){
                            isAd=1;
                        }
                        else if (res.code===400){
                            isAd=0;
                            thisDept=res.data.dept;
                        }
                    }
                })
                //按照是否为管理员显示下拉框
                if (res.code == 200) {
                    for (var i = 0; i < res.data.length; i++) {
                        if(isAd===1){
                            $("#deptName").append("<option value='" + res.data[i].id + "'>" + res.data[i].dept +"</option>");
                        }else if (isAd===0&&res.data[i].dept===thisDept){
                            $("#deptName").append("<option selected='selected' value='" + res.data[i].id + "'>" + res.data[i].dept +"</option>").attr('disabled','disabled');
                        }
                    }
                    form.render('select');
                }
            }
        })

    });

    function search(index) {
        //监听提交
        $('#cpkTable').css("display","none")
        $('#countResult').css("display","none")
        var orderNum=$('#orderNum').val();
        var deptId=$('#deptName').val();
        if(deptId==""||deptId==null){
            layer.msg("请先选择部门！")
        }else if(orderNum==""||orderNum==null){
            $('#cpkTable').removeAttr("style")
            $.ajax({
                url: url + '/cpk-info/listAll',
                method: 'POST',
                contentType: 'application/json',
                data: JSON.stringify({
                    displayStart: index,
                    displayLength:10,
                    loginName: sessionStorage.getItem('loginName'),
                    deptId: deptId
                }),
                success: function(res) {
                    $('#allTBody').empty();
                    displayStart = res.data.current;
                    endPage = res.data.pages;
                    list = res.data.records;
                    for (var i = 0; i < res.data.records.length; i++) {
                        $('#allTBody').append(
                            "<tr>" +
                            "<td class='organizeName'>" + res.data.records[i].orderNum + "</td>" +
                            "<td>" + res.data.records[i].pinName+ "</td>" +
                            "<td class='organizeName'>" + res.data.records[i].ca+ "</td>" +
                            "<td class='organizeName'>" + res.data.records[i].cp + "</td>" +
                            "<td class='organizeName'>" + res.data.records[i].cpk + "</td>" +
                            "<td>" + res.data.records[i].machineNum+"</td>" +
                            "<td class='operation' >" +
                            "<button type='button' class='layui-btn layui-btn-normal layui-btn-sm' onclick='updateCpk(\"" + res.data.records[i].orderNum + "\")'>查看详情</button>" +
                            "</td>" +
                            "</tr>"
                        );
                    }
                    $('#page').html(displayStart)
                }
            })
        }else {
            $.ajax({
                url: url + '/cpk-info/searchCpk',
                method: 'POST',
                async : false,
                contentType: 'application/json',
                data: JSON.stringify({
                    orderNum: orderNum,
                    loginName: sessionStorage.getItem('loginName'),
                    deptId: deptId
                }),
                success: function(res) {
                    if(res.code==400){
                        layer.msg(res.msg)
                    }else{
                        $('#CA_VALUE').empty().text(res.data.ca+"%");
                        $('#CP_VALUE').empty().text(res.data.cp);
                        $('#CPK_VALUE').empty().text(res.data.cpk);
                        $('#CA_LEVEL').empty().append(caLevel(res.data.ca+"%"));
                        $('#CP_LEVEL').empty().append(cpLevel(res.data.cp));
                        $('#CPK_LEVEL').empty().append(cpkLevel(res.data.cpk));
                        $('#numOfSearch').empty().val(orderNum)
                        //结果展示，按钮禁用
                        $('#countResult').removeAttr("style")
                    }
                }
            })
        }
    }

    function updateCpk(index){
        layer.open({
            type: 1,
            skin: 'layui-layer-rim',
            area: ['85%', '60%'],
            title: '<b style="color:red;">'+index+'</b> 详情',
            content: `

          <form class="layui-form" action="" style="width: 100%" id="countForm">
            <div class="layui-form-item" style="margin-top: 10px">
                <label class="layui-form-label">&nbsp;&nbsp;&nbsp;&nbsp;</label>
                <div class="layui-input-inline" style="width: 33%">
                    <div class="layui-row layui-col-space10">
                        <div class="layui-col-md3">
                            <input type="text" onkeyup="value=value.replace(/^\\D*(\\d*(?:\\.\\d{0,3})?).*$/g, '$1')" id="info_data_1" required  lay-verify="required" placeholder="请输入取样数值" autocomplete="off" class="layui-input">
                        </div>
                        <div class="layui-col-md3">
                            <input type="text" onkeyup="value=value.replace(/^\\D*(\\d*(?:\\.\\d{0,3})?).*$/g, '$1')" id="info_data_2" required  lay-verify="required" placeholder="请输入取样数值" autocomplete="off" class="layui-input">
                        </div>
                        <div class="layui-col-md3">
                            <input type="text" onkeyup="value=value.replace(/^\\D*(\\d*(?:\\.\\d{0,3})?).*$/g, '$1')" id="info_data_3" required  lay-verify="required" placeholder="请输入取样数值" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">取样数值：</label>
                <div class="layui-input-inline" style="width: 33%">
                    <div class="layui-row layui-col-space10">
                        <div class="layui-col-md3">
                            <input type="text" onkeyup="value=value.replace(/^\\D*(\\d*(?:\\.\\d{0,3})?).*$/g, '$1')" id="info_data_4" required  lay-verify="required" placeholder="请输入取样数值" autocomplete="off" class="layui-input">
                        </div>
                        <div class="layui-col-md3">
                            <input type="text" onkeyup="value=value.replace(/^\\D*(\\d*(?:\\.\\d{0,3})?).*$/g, '$1')" id="info_data_5" required  lay-verify="required" placeholder="请输入取样数值" autocomplete="off" class="layui-input">
                        </div>
                        <div class="layui-col-md3">
                            <input type="text" onkeyup="value=value.replace(/^\\D*(\\d*(?:\\.\\d{0,3})?).*$/g, '$1')" id="info_data_6" required  lay-verify="required" placeholder="请输入取样数值" autocomplete="off" class="layui-input">
                        </div>
                        <div class="layui-col-md3">
                            <input type="text" onkeyup="value=value.replace(/^\\D*(\\d*(?:\\.\\d{0,3})?).*$/g, '$1')" id="info_data_7" required  lay-verify="required" placeholder="请输入取样数值" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">&nbsp;&nbsp;&nbsp;&nbsp;</label>
                <div class="layui-input-inline" style="width: 33%">
                    <div class="layui-row layui-col-space10">
                        <div class="layui-col-md3">
                            <input type="text" onkeyup="value=value.replace(/^\\D*(\\d*(?:\\.\\d{0,3})?).*$/g, '$1')" id="info_data_8" required  lay-verify="required" placeholder="请输入取样数值" autocomplete="off" class="layui-input">
                        </div>
                        <div class="layui-col-md3">
                            <input type="text" onkeyup="value=value.replace(/^\\D*(\\d*(?:\\.\\d{0,3})?).*$/g, '$1')" id="info_data_9" required  lay-verify="required" placeholder="请输入取样数值" autocomplete="off" class="layui-input">
                        </div>
                        <div class="layui-col-md3">
                            <input type="text" onkeyup="value=value.replace(/^\\D*(\\d*(?:\\.\\d{0,3})?).*$/g, '$1')" id="info_data_10" required  lay-verify="required" placeholder="请输入取样数值" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">规格数值：</label>
                <div class="layui-input-inline" style="width: 33%">
                    <div class="layui-row layui-col-space10">
                        <div class="layui-col-md3">
                            <input type="text" onkeyup="value=value.replace(/^\\D*(\\d*(?:\\.\\d{0,3})?).*$/g, '$1')" name="info_lsl" id="info_lsl" required  lay-verify="required" placeholder="LSL/规格下限" class="layui-input">
                        </div>
                        <div class="layui-col-md3">
                            <input type="text" onkeyup="value=value.replace(/^\\D*(\\d*(?:\\.\\d{0,3})?).*$/g, '$1')" name="info_usl" id="info_usl" required  lay-verify="required" placeholder="USL/规格上限" class="layui-input">
                        </div>
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-row">
                    <div class="layui-col-md3">
                        <label class="layui-form-label">机台号：</label>
                        <div class="layui-input-inline">
                            <input disabled="disabled" type="text" name="info_machineNum" id="info_machineNum" required  lay-verify="required" placeholder="请输入机台号" class="layui-input">
                        </div>
                    </div>
                </div>
            </div>
          </form>
                <div class="layui-row" style="margin-bottom: 10px"></div>
                <input id="orderId" type="text" name="id" style="display: none;">

                <div class="layui-input-inline" style="margin: 5px;">
                <label class="layui-form-label">CA：</label>
                <div class="layui-input-inline " style="width: 15em"  >
                <input disabled="disabled" id="info_CA" type="text" name="info_CA" lay-verify="required" class="layui-input" autocomplete="off" style="margin-bottom: 10px ; width: 12em !important;">
                </div></div>

                <div class="layui-input-inline" style="margin: 5px;">
                <label class="layui-form-label">CP：</label>
                <div class="layui-input-inline " style="width: 15em"  >
                <input disabled="disabled" id="info_CP" type="text" name="info_CP" lay-verify="required" class="layui-input" autocomplete="off" style="margin-bottom: 10px ;width: 12em !important;">
                </div></div>

                <div class="layui-input-inline" style="margin: 5px;">
                <label class="layui-form-label">CPK：</label>
                <div class="layui-input-inline " style="width: 15em">
                <input disabled="disabled" id="info_CPK" type="text" lay-verify="required" name="info_CPK"  class="layui-input" autocomplete="off" style="margin-bottom: 10px;width: 12em !important;"></div>
                </div>

                <div align="center" style="margin: 15px">
                <button id="changeIt" type="button" class="layui-btn" lay-submit="" lay-filter="changeIt" >提 交 修 改</button>
                <button class="layui-btn layui-btn-danger" onclick="layer.closeAll()">取 消</button>
                </div>
          `,
            success: function(){
                $.ajax({
                    url: url + '/cpk-info/listInfo/'+index,
                    method: 'GET',
                    async : false,
                    contentType: 'application/json',
                    success: function(res) {
                        $('#info_machineNum').val(res.data.machineNum)
                        $('#info_lsl').val(res.data.lsl)
                        $('#info_usl').val(res.data.usl)
                        $('#info_CA').val(res.data.ca)
                        $('#info_CP').val(res.data.cp)
                        $('#info_CPK').val(res.data.cpk)
                        for(var i=1;i<=res.data.sdata.length;i++){
                            var str="#info_data_"+i
                            $(str).val(res.data.sdata[i-1])
                        }
                    }
                })
            }
        });
        //修改方法
        $('#changeIt').click(function () {
            var dataList=[];
            var lsl=$('#info_lsl').val();
            var usl=$('#info_usl').val();
            for(var i=1;i<=10;i++ ){
                var str="#info_data_"+i
                dataList.push($(str).val())
            }
            if (dataList.indexOf(null) != -1||dataList.indexOf("") != -1){
                layer.msg("请输入完整的取样值！")
            }else if(lsl==null||usl==null||lsl==""||usl==""){
                layer.msg("请输入正确的规格值！")
            }else {
                $.ajax({
                    url: url + '/cpk-info/updateCpk',
                    method: 'POST',
                    async : false,
                    contentType: 'application/json',
                    data: JSON.stringify({
                        orderNum:index,
                        dataList:dataList,
                        usl:usl,
                        lsl:lsl
                    }),
                    success: function(res) {
                        layer.closeAll()
                        if(res.code==200){
                            layer.alert(res.msg, {
                                icon: 1,
                                skin: 'layer-ext-demo' //见：扩展说明
                            })
                        }else {
                            layer.alert(res.msg, {
                                icon: 2,
                                skin: 'layer-ext-demo' //见：扩展说明
                            })
                        }
                        search(displayStart)
                    }
                })
            }
        })
    }

    $('#infoBtn').click(function () {
        layer.open({
            type: 1,
            skin: 'layui-layer-rim',
            area: ['85%', '60%'],
            title: '<b style="color:red;">'+$('#numOfSearch').val()+'</b> 详情',
            content: `

          <form class="layui-form" action="" style="width: 100%" id="countForm">
            <div class="layui-form-item" style="margin-top: 10px">
                <label class="layui-form-label">&nbsp;&nbsp;&nbsp;&nbsp;</label>
                <div class="layui-input-inline" style="width: 33%">
                    <div class="layui-row layui-col-space10">
                        <div class="layui-col-md3">
                            <input type="text" onkeyup="value=value.replace(/^\\D*(\\d*(?:\\.\\d{0,3})?).*$/g, '$1')" id="info_data_1" required  lay-verify="required" placeholder="请输入取样数值" autocomplete="off" class="layui-input">
                        </div>
                        <div class="layui-col-md3">
                            <input type="text" onkeyup="value=value.replace(/^\\D*(\\d*(?:\\.\\d{0,3})?).*$/g, '$1')" id="info_data_2" required  lay-verify="required" placeholder="请输入取样数值" autocomplete="off" class="layui-input">
                        </div>
                        <div class="layui-col-md3">
                            <input type="text" onkeyup="value=value.replace(/^\\D*(\\d*(?:\\.\\d{0,3})?).*$/g, '$1')" id="info_data_3" required  lay-verify="required" placeholder="请输入取样数值" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">取样数值：</label>
                <div class="layui-input-inline" style="width: 33%">
                    <div class="layui-row layui-col-space10">
                        <div class="layui-col-md3">
                            <input type="text" onkeyup="value=value.replace(/^\\D*(\\d*(?:\\.\\d{0,3})?).*$/g, '$1')" id="info_data_4" required  lay-verify="required" placeholder="请输入取样数值" autocomplete="off" class="layui-input">
                        </div>
                        <div class="layui-col-md3">
                            <input type="text" onkeyup="value=value.replace(/^\\D*(\\d*(?:\\.\\d{0,3})?).*$/g, '$1')" id="info_data_5" required  lay-verify="required" placeholder="请输入取样数值" autocomplete="off" class="layui-input">
                        </div>
                        <div class="layui-col-md3">
                            <input type="text" onkeyup="value=value.replace(/^\\D*(\\d*(?:\\.\\d{0,3})?).*$/g, '$1')" id="info_data_6" required  lay-verify="required" placeholder="请输入取样数值" autocomplete="off" class="layui-input">
                        </div>
                        <div class="layui-col-md3">
                            <input type="text" onkeyup="value=value.replace(/^\\D*(\\d*(?:\\.\\d{0,3})?).*$/g, '$1')" id="info_data_7" required  lay-verify="required" placeholder="请输入取样数值" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">&nbsp;&nbsp;&nbsp;&nbsp;</label>
                <div class="layui-input-inline" style="width: 33%">
                    <div class="layui-row layui-col-space10">
                        <div class="layui-col-md3">
                            <input type="text" onkeyup="value=value.replace(/^\\D*(\\d*(?:\\.\\d{0,3})?).*$/g, '$1')" id="info_data_8" required  lay-verify="required" placeholder="请输入取样数值" autocomplete="off" class="layui-input">
                        </div>
                        <div class="layui-col-md3">
                            <input type="text" onkeyup="value=value.replace(/^\\D*(\\d*(?:\\.\\d{0,3})?).*$/g, '$1')" id="info_data_9" required  lay-verify="required" placeholder="请输入取样数值" autocomplete="off" class="layui-input">
                        </div>
                        <div class="layui-col-md3">
                            <input type="text" onkeyup="value=value.replace(/^\\D*(\\d*(?:\\.\\d{0,3})?).*$/g, '$1')" id="info_data_10" required  lay-verify="required" placeholder="请输入取样数值" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">规格数值：</label>
                <div class="layui-input-inline" style="width: 33%">
                    <div class="layui-row layui-col-space10">
                        <div class="layui-col-md3">
                            <input type="text" onkeyup="value=value.replace(/^\\D*(\\d*(?:\\.\\d{0,3})?).*$/g, '$1')" name="info_lsl" id="info_lsl" required  lay-verify="required" placeholder="LSL/规格下限" class="layui-input">
                        </div>
                        <div class="layui-col-md3">
                            <input type="text" onkeyup="value=value.replace(/^\\D*(\\d*(?:\\.\\d{0,3})?).*$/g, '$1')" name="info_usl" id="info_usl" required  lay-verify="required" placeholder="USL/规格上限" class="layui-input">
                        </div>
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-row">
                    <div class="layui-col-md3">
                        <label class="layui-form-label">机台号：</label>
                        <div class="layui-input-inline">
                            <input disabled="disabled" type="text" name="info_machineNum" id="info_machineNum" required  lay-verify="required" placeholder="请输入机台号" class="layui-input">
                        </div>
                    </div>
                </div>
            </div>
          </form>
                <div class="layui-row" style="margin-bottom: 10px"></div>
                <input id="orderId" type="text" name="id" style="display: none;">

                <div class="layui-input-inline" style="margin: 5px;">
                <label class="layui-form-label">CA：</label>
                <div class="layui-input-inline " style="width: 15em"  >
                <input disabled="disabled" id="info_CA" type="text" name="info_CA" lay-verify="required" class="layui-input" autocomplete="off" style="margin-bottom: 10px ; width: 12em !important;">
                </div></div>

                <div class="layui-input-inline" style="margin: 5px;">
                <label class="layui-form-label">CP：</label>
                <div class="layui-input-inline " style="width: 15em"  >
                <input disabled="disabled" id="info_CP" type="text" name="info_CP" lay-verify="required" class="layui-input" autocomplete="off" style="margin-bottom: 10px ;width: 12em !important;">
                </div></div>

                <div class="layui-input-inline" style="margin: 5px;">
                <label class="layui-form-label">CPK：</label>
                <div class="layui-input-inline " style="width: 15em">
                <input disabled="disabled" id="info_CPK" type="text" lay-verify="required" name="info_CPK"  class="layui-input" autocomplete="off" style="margin-bottom: 10px;width: 12em !important;"></div>
                </div>

                <div align="center" style="margin: 15px">
                <button id="changeIt" type="button" class="layui-btn" lay-submit="" lay-filter="changeIt" >提 交 修 改</button>
                <button class="layui-btn layui-btn-danger" onclick="layer.close(layer.index)">取 消</button>
                </div>
          `,
            success: function(){
                $('#info_CA').val($('#CA_VALUE').text().replace('%',''))
                $('#info_CP').val($('#CP_VALUE').text())
                $('#info_CPK').val($('#CPK_VALUE').text())
                $.ajax({
                    url: url + '/cpk-info/listInfo/'+$('#numOfSearch').val(),
                    method: 'GET',
                    async : false,
                    contentType: 'application/json',
                    success: function(res) {
                        $('#info_machineNum').val(res.data.machineNum)
                        $('#info_lsl').val(res.data.lsl)
                        $('#info_usl').val(res.data.usl)
                        for(var i=1;i<=res.data.sdata.length;i++){
                            var str="#info_data_"+i
                            $(str).val(res.data.sdata[i-1])
                        }
                    }
                })
            }
        });
        //修改方法
        $('#changeIt').click(function () {
            var dataList=[];
            var lsl=$('#info_lsl').val();
            var usl=$('#info_usl').val();
            for(var i=1;i<=10;i++ ){
                var str="#info_data_"+i
                dataList.push($(str).val())
            }
            if (dataList.indexOf(null) != -1||dataList.indexOf("") != -1){
                layer.msg("请输入完整的取样值！")
            }else if(lsl==null||usl==null||lsl==""||usl==""){
                layer.msg("请输入正确的规格值！")
            }else {
                $.ajax({
                    url: url + '/cpk-info/updateCpk',
                    method: 'POST',
                    async : false,
                    contentType: 'application/json',
                    data: JSON.stringify({
                        orderNum:$('#numOfSearch').val(),
                        dataList:dataList,
                        usl:usl,
                        lsl:lsl
                    }),
                    success: function(res) {
                        layer.closeAll()
                        if(res.code==200){
                            layer.alert(res.msg, {
                                icon: 1,
                                skin: 'layer-ext-demo' //见：扩展说明
                            })
                        }else {
                            layer.alert(res.msg, {
                                icon: 2,
                                skin: 'layer-ext-demo' //见：扩展说明
                            })
                        }
                        search(1)
                    }
                })
            }
        })
    })

</script>
</body>
</html>